Network Adapters
In computer networks a host computer system is normally connected to the network by a network adapter. In some designs, the network adapter is a board that plugs into the backplane bus of the host computer system. In other designs, the network adapter is built into the CPU motherboard. The host computer system typically includes a device driver which operates the network adapter.
Computer networks transfer data from one network node to another in the form of packets. For the purposes here, packets may include information for all layers of the ISO/OSI model at and above the data link layer. The network adapter transmits packets from the host computer system onto the network, and delivers packets from the network to the host computer system.
Producer/Consumer Model and Notification
During operation, the host computer system produces two types of host memory buffers that are consumed by the network adapter: (1) transmit buffers containing packets to be transmitted onto the network, and (2) receive buffers to hold packets received from the network. The host computer system notifies the network adapter when either type of host memory buffer is produced. Similarly, the network adapter notifies the host computer system when it finishes consuming either type of buffer.
For example, to transmit a packet onto the network, the host computer system produces a transmit buffer by allocating a host memory buffer from a free pool of memory buffers, and writing the packet to the host memory buffer. The host computer system then notifies the network adapter that the transmit buffer has been produced (the packet is ready for transmission). The network adapter consumes the transmit buffer by transmitting the packet onto the network. The network adapter then notifies the host computer system that the buffer has been consumed (transmission has completed). To receive a packet from the network, the host computer system first produces a receive buffer by allocating a host memory buffer into which a packet from the network may be received. The host computer system then notifies the network adapter that the receive buffer has been produced. When the network adapter subsequently receives a packet from the network to be stored in host memory, it consumes the receive buffer by writing the packet to it. The network adapter then notifies the host that the receive buffer has been consumed (the packet has been received).
When the host computer system is notified that a host memory buffer has been consumed (either a transmit buffer or a receive buffer), it completes the processing of that host memory buffer. The host computer system completes processing a consumed transmit buffer by returning the transmit buffer to the free pool of host memory buffers. The host computer system completes processing a consumed receive memory buffer by delivering the received packet to the appropriate user process, and then returning the receive buffer to the free pool of host memory buffers.
The host computer system typically notifies the network adapter after each host memory buffer has been produced by writing a register on the network adapter. The network adapter typically notifies the host computer system after each host memory buffer has been consumed by sending an interrupt to the host processor in the host computer system.
Minimizing Notifications
In a multiprocessing host computer system, where many user processes execute on a single processor, the cost of processing interrupts from peripheral devices, such as a network adapter, is severe. Interrupt processing causes suspension of instruction execution, process context switching, and instruction execution at a relatively high priority level. All of these effects increase response time and latency experienced by the processes executing on the interrupted processor.
Performance of such a host computer system can therefore be improved by reducing the number of interrupts generated by the network adapter. One way to reduce the number of interrupts is for the host computer system to process longer bursts of data in response to a single interrupt, and for the network adapter to avoid sending unnecessary interrupts.
Moreover, network traffic is typically bursty, making it convenient to transfer data between the host computer system and the network adapter in relatively long bursts. For example, a node in a token ring network must wait for a token before it can transfer data packets on the network. As a result, there is a tendency for multiple data packets (packet trains) to be transferred on the network in a single burst.
Under these circumstances, one way in which a network adapter can avoid sending unnecessary interrupts is by sending only a single interrupt when multiple data packets can be transferred between the host computer system and the network adapter in a single burst. When the host computer system is requested to service the interrupt, it is desirable for the host system to process an entire packet train rather than a single data packet.
Unfortunately, the network adapter cannot decide whether an additional interrupt of the host system is necessary (e.g., in response to the reciept by the network adapter of an additional data packet) unless the network adapter obtains or receives information indicating how much work has been done by the host computer system. Accordingly, it is desirable to provide a network adapter which can determine whether host memory buffers that have been consumed by the network adapter have been processed by the host computer system.
It is therefore desirable to have a network adapter design which minimizes the number of interrupts issued by the network adapter to the host computer system, such that unnecessary interrupts are substantially eliminated.